package com.example.dllo.exe.fenlei.gonglue;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import com.example.dllo.exe.R;
import com.example.dllo.exe.bean.GongLueBean;
import com.example.dllo.exe.fengzhuang.NetTool;
import com.example.dllo.exe.main.BaseAty;
import com.example.dllo.exe.fengzhuang.DBValue;

/**
 * code is far away from bug with the animal protecting
 * <p/>
 * ┏┓　　　┏┓
 * ┏┛┻━━━┛┻┓
 * ┃　　　　　　　┃
 * ┃　　　━　　　┃
 * ┃　┳┛　┗┳　┃
 * ┃　　　　　　　┃
 * ┃　　　┻　　　┃
 * ┃　　　　　　　┃
 * ┗━┓　　　┏━┛
 * 　　┃　　　┃神兽保佑
 * 　　┃　　　┃永无BUG！  凯哥 祝你一路顺风
 * 　　┃　　　┗━━━┓
 * 　　┃　　　　　　　┣┓
 * 　　┃　　　　　　　┏┛
 * 　　┗┓┓┏━┳┓┏┛
 * 　　　┃┫┫　┃┫┫
 * 　　　┗┻┛　┗┻┛
 */
public class GongLueDuiXiangChaKanQuanBu extends BaseAty implements View.OnClickListener {
    private RecyclerView gonglueduixiangchakanquanburv;
    private ImageView imageViewduixiangback;
    @Override
    protected int setLayout() {
        return R.layout.gonglueduixiangchakanquanbulayout;
    }

    @Override
    protected void initView() {
       gonglueduixiangchakanquanburv=bindView(R.id.gonglueduixiangchakanquanbu_rv);
        imageViewduixiangback=bindView(R.id.image_duixiangback);
    }

    @Override
    protected void initData() {
        NetTool netTool =new NetTool( );
        netTool.getNetData(DBValue.FENLEI_GONGLUEDOWN, GongLueBean.class, new NetTool.NetListener<GongLueBean>() {
            @Override
            public void onSuccess(GongLueBean gongLueBean) {
                GongLueDuiXiangChaKanQuanBuAdapter gongLueDuiXiangChaKanQuanBuAdapter=new GongLueDuiXiangChaKanQuanBuAdapter(getApplicationContext());
                GridLayoutManager manager=new GridLayoutManager(getApplicationContext(),2);
                gonglueduixiangchakanquanburv.setLayoutManager(manager);
                gongLueDuiXiangChaKanQuanBuAdapter.setGongLueBean(gongLueBean);
                gonglueduixiangchakanquanburv.setAdapter(gongLueDuiXiangChaKanQuanBuAdapter);
            }

            @Override
            public void onError(String errorMsg) {

            }
        });imageViewduixiangback.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        finish();
    }
}
